Model train control system

ABSTRACT

A system which operates a digitally controlled model railroad transmitting a first command from a first client program to a resident external controlling interface through a first communications transport. A second command is transmitted from a second client program to the resident external controlling interface through a second communications transport. The first command and the second command are received by the resident external controlling interface which queues the first and second commands. The resident external controlling interface sends third and fourth commands representative of the first and second commands, respectively, to a digital command station for execution on the digitally controlled model railroad.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.11/981,263, filed Oct. 30, 2007, which is a continuation of U.S. patentapplication Ser. No. 11/607,233, filed Dec. 1, 2006, which is acontinuation of U.S. patent application Ser. No. 11/375,794, filed Mar.14, 2006, now U.S. Pat. No. 7,209,812, which is a continuation of U.S.patent application Ser. No. 10/989,815, filed Nov. 16, 2004, now U.S.Pat. No. 7,177,733, which is a continuation of U.S. patent applicationSer. No. 10/713,476, filed Nov. 14, 2003, now U.S. Pat. No. 6,909,945,which is a continuation of U.S. patent application Ser. No. 09/311,936,filed May 14, 1999, now U.S. Pat. No. 6,676,089, which is a continuationof U.S. patent application Ser. No. 09/104,461, filed Jun. 24, 1998, nowU.S. Pat. No. 6,065,406.

BACKGROUND OF THE INVENTION

The present invention relates to a system for controlling a modelrailroad.

Model railroads have traditionally been constructed with of a set ofinterconnected sections of train track, electric switches betweendifferent sections of the train track, and other electrically operateddevices, such as train engines and draw bridges. Train engines receivetheir power to travel on the train track by electricity provided by acontroller through the track itself. The speed and direction of thetrain engine is controlled by the level and polarity, respectively, ofthe electrical power supplied to the train track. The operator manuallypushes buttons or pulls levers to cause the switches or otherelectrically operated devices to function, as desired. Such modelrailroad sets are suitable for a single operator, but unfortunately theylack the capability of adequately controlling multiple trainsindependently. In addition, such model railroad sets are not suitablefor being controlled by multiple operators, especially if the operatorsare located at different locations distant from the model railroad, suchas different cities.

A digital command control (DDC) system has been developed to provideadditional controllability of individual train engines and otherelectrical devices. Each device the operator desires to control, such asa train engine, includes an individually addressable digital decoder. Adigital command station (DCS) is electrically connected to the traintrack to provide a command in the form of a set of encoded digital bitsto a particular device that includes a digital decoder. The digitalcommand station is typically controlled by a personal computer. Asuitable standard for the digital command control system is the NMRA DCCStandards, issued March 1997, and is incorporated herein by reference.While providing the ability to individually control different devices ofthe railroad set, the DCC system still fails to provide the capabilityfor multiple operators to control the railroad devices, especially ifthe operators are remotely located from the railroad set and each other.

DigiToys Systems of Lawrenceville, Ga. has developed a software programfor controlling a model railroad set from a remote location. Thesoftware includes an interface which allows the operator to selectdesired changes to devices of the railroad set that include a digitaldecoder, such as increasing the speed of a train or switching a switch.The software issues a command locally or through a network, such as theinternet, to a digital command station at the railroad set whichexecutes the command. The protocol used by the software is based onCobra from Open Management Group where the software issues a command toa communication interface and awaits confirmation that the command wasexecuted by the digital command station. When the software receivesconfirmation that the command executed, the software program sends thenext command through the communication interface to the digital commandstation. In other words, the technique used by the software to controlthe model railroad is analogous to an inexpensive printer where commandsare sequentially issued to the printer after the previous command hasbeen executed. Unfortunately, it has been observed that the response ofthe model railroad to the operator appears slow, especially over adistributed network such as the internet. One technique to decrease theresponse time is to use high-speed network connections but unfortunatelysuch connections are expensive.

What is desired, therefore, is a system for controlling a model railroadthat effectively provides a high-speed connection without the additionalexpense associated therewith.

BRIEF SUMMARY OF THE INVENTION

The present invention overcomes the aforementioned drawbacks of theprior art, in a first aspect, by providing a system for operating adigitally controlled model railroad that includes transmitting a firstcommand from a first client program to a resident external controllinginterface through a first communications transport. A second command istransmitted from a second client program to the resident externalcontrolling interface through a second communications transport. Thefirst command and the second command are received by the residentexternal controlling interface which queues the first and secondcommands. The resident external controlling interface sends third andfourth commands representative of the first and second commands,respectively, to a digital command station for execution on thedigitally controlled model railroad.

Incorporating a communications transport between the multiple clientprogram and the resident external controlling interface permits multipleoperators of the model railroad at locations distant from the physicalmodel railroad and each other. In the environment of a model railroadclub where the members want to simultaneously control devices of thesame model railroad layout, which preferably includes multiple trainsoperating thereon, the operators each provide commands to the resistantexternal controlling interface, and hence the model railroad. Inaddition by queuing by commands at a single resident externalcontrolling interface permits controlled execution of the commands bythe digitally controlled model railroad, would may otherwise conflictwith one another.

In another aspect of the present invention the first command isselectively processed and sent to one of a plurality of digital commandstations for execution on the digitally controlled model railroad basedupon information contained therein. Preferably, the second command isalso selectively processed and sent to one of the plurality of digitalcommand stations for execution on the digitally controlled modelrailroad based upon information contained therein. The resident externalcontrolling interface also preferably includes a command queue tomaintain the order of the commands.

The command queue also allows the sharing of multiple devices, multipleclients to communicate with the same device (locally or remote) in acontrolled manner, and multiple clients to communicate with differentdevices. In other words, the command queue permits the proper executionin the cases of: (1) one client to many devices, (2) many clients to onedevice, and (3) many clients to many devices.

In yet another aspect of the present invention the first command istransmitted from a first client program to a first processor through afirst communications transport. The first command is received at thefirst processor. The first processor provides an acknowledgement to thefirst client program through the first communications transportindicating that the first command has properly executed prior toexecution of commands related to the first command by the digitallycontrolled model railroad. The communications transport is preferably aCOM or DCOM interface.

The model railroad application involves the use of extremely slowreal-time interfaces between the digital command stations and thedevices of the model railroad. In order to increase the apparent speedof execution to the client, other than using high-speed communicationinterfaces, the resident external controller interface receives thecommand and provides an acknowledgement to the client program in atimely manner before the execution of the command by the digital commandstations. Accordingly, the execution of commands provided by theresident external controlling interface to the digital command stationsoccur in a synchronous manner, such as a first-in-first-out manner. TheCOM and DOOM communications transport between the client program and theresident external controlling interface is operated in an asynchronousmanner, namely providing an acknowledgement thereby releasing thecommunications transport to accept further communications prior to theactual execution of the command. The combination of the synchronous andthe asynchronous data communication for the commands provides thebenefit that the operator considers the commands to occur nearlyinstantaneously while permitting the resident external controllinginterface to verify that the command is proper and cause the commands toexecute in a controlled manner by the digital command stations, allwithout additional high-speed communication networks. Moreover, fortraditional distributed software execution there is no motivation toprovide an acknowledgment prior to the execution of the command becausethe command executes quickly and most commands are sequential in nature.In other words, the execution of the next command is dependent uponproper execution of the prior command so there would be no motivation toprovide an acknowledgment prior to its actual execution.

The foregoing and other objectives, features, and advantages of theinvention will be more readily understood upon consideration of thefollowing detailed description of the invention, taken in conjunctionwith the accompanying drawings.

BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS

FIG. 1 is a block diagram of an exemplary embodiment of a model traincontrol system.

FIG. 2 is a more detailed block diagram of the model train controlsystem of FIG. 1 including external device control logic.

FIG. 3 is a block diagram of the external device control logic of FIG.2.

FIG. 4 is an illustration of a track and signaling arrangement.

FIG. 5 is an illustration of a manual block signaling arrangement.

FIG. 6 is an illustration of a track circuit.

FIGS. 7A and 7B are illustrations of block signaling and track capacity.

FIG. 8 is an illustration of different types of signals.

FIGS. 9A and 9B are illustrations of speed signaling in approach to ajunction.

FIG. 10 is a further embodiment of the system including a dispatcher.

DETAILED DESCRIPTION OF PREFERRED EMBODIMENT

Referring to FIG. 1, a model train control system 10 includes acommunications transport 12 interconnecting a client program 14 and aresident external controlling interface 16. The client program 14executes on the model railroad operator's computer and may include anysuitable system to permit the operator to provide desired commands tothe resident external controlling interface 16. For example, the clientprogram 14 may include a graphical interface representative of the modelrailroad layout where the operator issues commands to the model railroadby making changes to the graphical interface. The client program 14 alsodefines a set of Application Programming Interfaces (API's), describedin detail later, which the operator accesses using the graphicalinterface or other programs such as Visual Basic, C++, Java, or browserbased applications, There may be multiple client programs interconnectedwith the resident external controlling interface 16 so that multipleremote operators may simultaneously provide control commands to themodel railroad.

The communications transport 12 provides an interface between the clientprogram 14 and the resident external controlling interface 16. Thecommunications transport 12 may be any suitable communications mediumfor the transmission of data, such as the internet, local area network,satellite links, or multiple processes operating on a single computer.The preferred interface to the communications transport 12 is a COM orDCOM interface, as developed for the Windows operating system availablefrom Microsoft Corporation. The communications transport 12 alsodetermines if the resident external controlling interface 16 is systemresident or remotely located on an external system. The communicationstransport 12 may also use private or public communications protocol as amedium for communications. The client program 14 provides commands andthe resident external controlling interface 16 responds to thecommunications transport 12 to exchange information. A description ofCOM (common object model) and DCOM (distributed common object model) isprovided by Chappel in a book entitled Understanding ActiveX and OLE,Microsoft Press, and is incorporated by reference herein.

Incorporating a communications transport 12 between the clientprogram(s) 14 and the resident external controlling interface 16 permitsmultiple operators of the model railroad at locations distant from thephysical model railroad and each other. In the environment of a modelrailroad club where the members want to simultaneously control devicesof the same model railroad layout, which preferably includes multipletrains operating thereon, the operators each provide commands to theresistant external controlling interface, and hence the model railroad.

The manner in which commands are executed for the model railroad underCOM and DCOM may be as follows, The client program 14 makes requests ina synchronous manner using COM/DCOM to the resident external interfacecontroller 16. The synchronous manner of the request is the techniqueused by COM and DCOM to execute commands. The communications transport12 packages the command for the transport mechanism to the residentexternal controlling interface 16. The resident external controllinginterface 16 then passes the command to the digital command stations 18which in turn executes the command. After the digital command station 18executes the command an acknowledgement is passed back to the residentexternal controlling interface 16 which in turn passes anacknowledgement to the client program 14. Upon receipt of theacknowledgement by the client program 14, the communications transport12 is again available to accept another command. The train controlsystem 10, without more, permits execution of commands by the digitalcommand stations 18 from multiple operators, but like the DigiToysSystems' software the execution of commands is slow.

The present inventor came to the realization that unlike traditionaldistributed systems where the commands passed through a communicationstransport are executed nearly instantaneously by the server and then anacknowledgement is returned to the client, the model railroadapplication involves the use of extremely slow real-time interfacesbetween the digital command stations and the devices of the modelrailroad. The present inventor came to the further realization that inorder to increase the apparent speed of execution to the client, otherthan using high-speed communication interfaces, the resident externalcontroller interface 16 should receive the command and provide anacknowledgement to the client program 12 in a timely manner before theexecution of the command by the digital command stations 18.Accordingly, the execution of commands provided by the resident externalcontrolling interface 16 to the digital command stations 18 occur in asynchronous manner, such as a first-in-first-out manner. The COM andDCOM communications transport 12 between the client program 14 and theresident external controlling interface 16 is operated in anasynchronous manner, namely providing an acknowledgement therebyreleasing the communications transport 12 to accept furthercommunications prior to the actual execution of the command. Thecombination of the synchronous and the asynchronous data communicationfor the commands provides the benefit that the operator considers thecommands to occur nearly instantaneously while permitting the residentexternal controlling interface 16 to verify that the command is properand cause the commands to execute in a controlled manner by the digitalcommand stations 18, all without additional high-speed communicationnetworks. Moreover, for traditional distributed software execution thereis no motivation to provide an acknowledgment prior to the execution ofthe command because the command executes quickly and most commands aresequential in nature. In other words, the execution of the next commandis dependent upon proper execution of the prior command so there wouldbe no motivation to provide an acknowledgment prior to its actualexecution. It is to be understood that other devices, such as digitaldevices, may be controlled in a manner as described for model railroads.

Referring to FIG. 2, the client program 14 sends a command over thecommunications transport 12 that is received by an asynchronous commandprocessor 100. The asynchronous command processor 100 queries a localdatabase storage 102 to determine if it is necessary to package acommand to be transmitted to a command queue 104. The local databasestorage 102 primarily contains the state of the devices of the modelrailroad, such as for example, the speed of a train, the direction of atrain, whether a draw bridge is up or down, whether a light is turned onor off, and the configuration of the model railroad layout. If thecommand received by the asynchronous command processor 100 is a query ofthe state of a device, then the asynchronous command processor 100retrieves such information from the local database storage 102 andprovides the information to an asynchronous response processor 106. Theasynchronous response processor 106 then provides a response to theclient program 14 indicating the state of the device and releases thecommunications transport 12 for the next command.

The asynchronous command processor 100 also verifies, using theconfiguration information in the local database storage 102, that thecommand received is a potentially valid operation. If the command isinvalid, the asynchronous command processor 100 provides suchinformation to the asynchronous response processor 106, which in turnreturns an error indication to the client program 14.

The asynchronous command processor 100 may determine that the necessaryinformation is not contained in the local database storage 102 toprovide a response to the client program 14 of the device state or thatthe command is a valid action. Actions may include, for example, anincrease in the train's speed, or turning on/off of a device. In eithercase, the valid unknown state or action command is packaged andforwarded to the command queue 104. The packaging of the command mayalso include additional information from the local database storage 102to complete the client program 14 request, if necessary. Together withpackaging the command for the command queue 104, the asynchronouscommand processor 100 provides a command to the asynchronous requestprocessor 106 to provide a response to the client program 14 indicatingthat the event has occurred, even though such an event has yet to occuron the physical railroad layout.

As such, it can be observed that whether or not the command is valid,whether or not the information requested by the command is available tothe asynchronous command processor 100, and whether or not the commandhas executed, the combination of the asynchronous command processor 100and the asynchronous response processor 106 both verifies the validityof the command and provides a response to the client program 14 therebyfreeing up the communications transport 12 for additional commands.Without the asynchronous nature of the resident external controllinginterface 16, the response to the client program 14 would be, in manycircumstances, delayed thereby resulting in frustration to the operatorthat the model railroad is performing in a slow and painstaking manner.In this manner, the railroad operation using the asynchronous interfaceappears to the operator as nearly instantaneously responsive.

Each command in the command queue 104 is fetched by a synchronouscommand processor 110 and processed. The synchronous command processor110 queries a controller database storage 112 for additionalinformation, as necessary, and determines if the command has alreadybeen executed based on the state of the devices in the controllerdatabase storage 112. In the event that the command has already beenexecuted, as indicated by the controller database storage 112, then thesynchronous command processor 110 passes information to the commandqueue 104 that the command has been executed or the state of the device.The asynchronous response processor 106 fetches the information from thecommand cue 104 and provides a suitable response to the client program14, if necessary, and updates the local database storage 102 to reflectthe updated status of the railroad layout devices.

If the command fetched by the synchronous command processor 110 from thecommand queue 104 requires execution by external devices, such as thetrain engine, then the command is posted to one of several externaldevice control logic 114 blocks. The external device control logic 114processes the command from the synchronous command processor 110 andissues appropriate control commands to the interface of the particularexternal device 116 to execute the command on the device and ensure thatan appropriate response was received in response. The external device ispreferably a digital command control device that transmits digitalcommands to decoders using the train track. There are several differentmanufacturers of digital command stations, each of which has a differentset of input commands, so each external device is designed for aparticular digital command station. In this manner, the system iscompatible with different digital command stations. The digital commandstations 18 of the external devices 116 provide a response to theexternal device control logic 114 which is checked for validity andidentified as to which prior command it corresponds to so that thecontroller database storage 112 may be updated properly. The process oftransmitting commands to and receiving responses from the externaldevices 116 is slow.

The synchronous command processor 110 is notified of the results fromthe external control logic 114 and, if appropriate, forwards the resultsto the command queue 104. The asynchronous response processor 100 clearsthe results from the command queue 104 and updates the local databasestorage 102 and sends an asynchronous response to the client program 14,if needed. The response updates the client program 14 of the actualstate of the railroad track devices, if changed, and provides an errormessage to the client program 14 if the devices actual state waspreviously improperly reported or a command did not execute properly.

The use of two separate database storages, each of which issubstantially a mirror image of the other, provides a performanceenhancement by a fast acknowledgement to the client program 14 using thelocal database storage 102 and thereby freeing up the communicationstransport 12 for additional commands. In addition, the number ofcommands forwarded to the external device control logic 114 and theexternal devices 116, which are relatively slow to respond, is minimizedby maintaining information concerning the state and configuration of themodel railroad. Also, the use of two separate database tables 102 and112 allows more efficient multi-threading on multi-processor computers.

In order to achieve the separation of the asynchronous and synchronousportions of the system the command queue 104 is implemented as a namedpipe, as developed by Microsoft for Windows. The queue 104 allows bothportions to be separate from each other, where each considers the otherto be the destination device. In addition, the command queue maintainsthe order of operation which is important to proper operation of thesystem.

The use of a single command queue 104 allows multiple instant rations ofthe asynchronous functionality, with one for each different client. Thesingle command queue 104 also allows the sharing of multiple devices,multiple clients to communicate with the same device (locally or remote)in a controlled manner, and multiple clients to communicate withdifferent devices. In other words, the command queue 104 permits theproper execution in the cases of: (1) one client to many devices, (2)many clients to one device, and (3) many clients to many devices.

The present inventor came to the realization that the digital commandstations provided by the different vendors have at least three differenttechniques for communicating with the digital decoders of the modelrailroad set. The first technique, generally referred to as atransaction (one or more operations), is a synchronous communicationwhere a command is transmitted, executed, and a response is receivedtherefrom prior to the transmission of the next sequentially receivedcommand. The DCS may execute multiple commands in this transaction. Thesecond technique is a cache with out of order execution where a commandis executed and a response received therefrom prior to the execution ofthe next command, but the order of execution is not necessarily the sameas the order that the commands were provided to the command station. Thethird technique is a local-area-network model where the commands aretransmitted and received simultaneously. In the LAN model there is norequirement to wait until a response is received for a particularcommand prior to sending the next command. Accordingly, the LAN modelmay result in many commands being transmitted by the command stationthat have yet to be executed. In addition, some digital command stationsuse two or more of these techniques.

With all these different techniques used to communicate with the modelrailroad set and the system 10 providing an interface for each differenttype of command station, there exists a need for the capability ofmatching up the responses from each of the different types of commandstations with the particular command issued for record keeping purposes.Without matching up the responses from the command stations, thedatabases can not be updated properly.

Validation functionality is included within the external device controllogic 114 to accommodate all of the different types of command stations.Referring to FIG. 3, an external command processor 200 receives thevalidated command from the synchronous command processor 110. Theexternal command processor 200 determines which device the commandshould be directed to, the particular type of command it is, and buildsstate information for the command. The state information includes, forexample, the address, type, port, variables, and type of commands to besent out. In other words, the state information includes a command setfor a particular device on a particular port device. In addition, a copyof the original command is maintained for verification purposes. Theconstructed command is forwarded to the command sender 202 which isanother queue, and preferably a circular queue. The command sender 202receives the command and transmits commands within its queue in arepetitive nature until the command is removed from its queue. A commandresponse processor 204 receives all the commands from the commandstations and passes the commands to the validation function 206. Thevalidation function 206 compares the received command against potentialcommands that are in the queue of the command sender 202 that couldpotentially provide such a result. The validation function 206determines one of four potential results from the comparison. First, theresults could be simply bad data that is discarded. Second, the resultscould be partially executed commands which are likewise normallydiscarded. Third, the results could be valid responses but not relevantto any command sent. Such a case could result from the operator manuallychanging the state of devices on the model railroad or from anotherexternal device, assuming a shared interface to the DCS. Accordingly,the results are validated and passed to the result processor 210.Fourth, the results could be valid responses relevant to a command sent.The corresponding command is removed from the command sender. 202 andthe results passed to the result processor 210. The commands in thequeue of the command sender 202, as a result of the validation process206, are retransmitted a predetermined number of times, then if errorstill occurs the digital command station is reset, which if the errorstill persists then the command is removed and the operator is notifiedof the error.

The digital command stations 18 program the digital devices, such as alocomotive and switches, of the railroad layout. For example, alocomotive may include several different registers that control thehorn, how the light blinks, speed curves for operation, etc. In manysuch locomotives there are 106 or more programable values.Unfortunately, it may take 1-10 seconds per byte wide word if a validregister or control variable (generally referred to collectively asregisters) and two to four minutes to error out if an invalid registerto program such a locomotive or device, either of which may contain adecoder. With a large number of byte wide words in a locomotive itstakes considerable time to fully program the locomotive. Further, with arailroad layout including many such locomotives and other programmabledevices, it takes a substantial amount of time to completely program allthe devices of the model railroad layout. During the programming of therailroad layout, the operator is sitting there not, enjoying theoperation of the railroad layout, is frustrated, loses operatingenjoyment, and will not desire to use digital programmable devices. Inaddition, to reprogram the railroad layout the operator must reprogramall of the devices of the entire railroad layout which takes substantialtime. Similarly, to determine the state of all the devices of therailroad layout the operator must read the registers of each devicelikewise taking substantial time. Moreover, to reprogram merely a fewbytes of a particular device requires the operator to previously knowthe state of the registers of the device which is obtainable by readingthe registers of the device taking substantial time, thereby stillfrustrating the operator.

The present inventor came to the realization that for the operation of amodel railroad the anticipated state of the individual devices of therailroad, as programmed, should be maintained during the use of themodel railroad and between different uses of the model railroad. Bymaintaining data representative of the current state of the deviceregisters of the model railroad determinations may be made toefficiently program the devices. When the user designates a command tobe executed by one or more of the digital command stations 18, thesoftware may determine which commands need to be sent to one or more ofthe digital command stations 18 of the model railroad. By only updatingthose registers of particular devices that are necessary to implementthe commands of a particular user, the time necessary to program therailroad layout is substantially reduced. For example, if the commandwould duplicate the current state of the device then no command needs tobe forwarded to the digital command stations 18. This preventsredundantly programming the devices of the model railroad, therebyfreeing up the operation of the model railroad for other activities.

Unlike a single-user single-railroad environment, the system of thepresent invention may encounter “conflicting” commands that attempt towrite to and read from the devices of the model railroad. For example,the “conflicting” commands may inadvertently program the same device inan inappropriate manner, such as the locomotive to speed up to maximumand the locomotive to stop. In addition, a user that desires to read thestatus of the entire model railroad layout will monopolize the digitaldecoders and command stations for a substantial time, such as up to twohours, thereby preventing the enjoyment of the model railroad for theother users. Also, a user that programs an extensive number of deviceswill likewise monopolize the digital decoders and command stations for asubstantial time thereby preventing the enjoyment of the model railroadfor other users.

In order to implement a networked selective updating technique thepresent inventor determined that it is desirable to implement both awrite cache and a read cache. The write cache contains those commandsyet to be programmed by the digital command stations 18. Valid commandsfrom each user are passed to a queue in the write cache. In the event ofmultiple commands from multiple users (depending on user permissions andsecurity) or the same user for the same event or action, the write cachewill concatenate the two commands into a single command to be programmedby the digital command stations 18. In the event of multiple commandsfrom multiple users or the same user for different events or actions,the write cache will concatenate the two commands into a single commandto be programmed by the digital command stations 18. The write cache mayforward either of the commands, such as the last received command, tothe digital command station. The users are updated with the actualcommand programmed by the digital command station, as necessary.

The read cache contains the state of the different devices of the modelrailroad. After a command has been written to a digital device andproperly acknowledged, if necessary, the read cache is updated with thecurrent state of the model railroad. In addition, the read cache isupdated with the state of the model railroad when the registers of thedevices of the model railroad are read. Prior to sending the commands tobe executed by the digital command stations 18 the data in the writecache is compared against the data in the read cache. In the event thatthe data in the read cache indicates that the data in the write cachedoes not need to be programmed, the command is discarded. In contrast,if the data in the read cache indicates that the data in the write cacheneeds to be programmed, then the command is programmed by the digitalcommand station. After programming the command by the digital commandstation the read cache is updated to reflect the change in the modelrailroad. As becomes apparent, the use of a write cache and a read cachepermits a decrease in the number of registers that need to beprogrammed, thus speeding up the apparent operation of the modelrailroad to the operator.

The present inventor further determined that errors in the processing ofthe commands by the railroad and the initial unknown state of the modelrailroad should be taken into account for a robust system. In the eventthat an error is received in response to an attempt to program (or read)a device, then the state of the relevant data of the read cache ismarked as unknown. The unknown state merely indicates that the state ofthe register has some ambiguity associated therewith. The unknown statemay be removed by reading the current state of the relevant device orthe data rewritten to the model railroad without an error occurring. Inaddition, if an error is received in response to an attempt to program(or read) a device, then the command may be re-transmitted to thedigital command station in an attempt to program the device properly. Ifdesirable, multiple commands may be automatically provided to thedigital command stations to increase the likelihood of programming theappropriate registers. In addition, the initial state of a register islikewise marked with an unknown state until data becomes availableregarding its state.

When sending the commands to be executed by the digital command stations18 they are preferably first checked against the read cache, aspreviously mentioned. In the event that the read cache indicates thatthe state is unknown, such as upon initialization or an error, then thecommand should be sent to the digital command station because the stateis not known. In this manner the state will at least become known, evenif the data in the registers is not actually changed.

The present inventor further determined a particular set of data that isuseful for a complete representation of the state of the registers ofthe devices of the model railroad.

An invalid representation of a register indicates that the particularregister is not valid for both a read and a write operation. Thispermits the system to avoid attempting to read from and write toparticular registers of the model railroad. This avoids theexceptionally long error out when attempting to access invalidregisters.

An in use representation of a register indicates that the particularregister is valid for both a read and a write operation. This permitsthe system to read from and write to particular registers of the modelrailroad. This assists in accessing valid registers where the responsetime is relatively fast.

A read error (unknown state) representation of a register indicates thateach time an attempt to read a particular register results in an error.

A read dirty representation of a register indicates that the data in theread cache has not been validated by reading its valid from the decoder.If both the read error and the read dirty representations are clear thena valid read from the read cache may be performed. A read dirtyrepresentation may be cleared by a successful write operation, ifdesired.

A read only representation indicates that the register may not bewritten to. If this flag is set then a write error may not occur.

A write error (unknown state) representation of a register indicatesthat each time an attempt to write to a particular register results inan error.

A write dirty representation of a register indicates that the data inthe write cache has not been written to the decoder yet. For example,when programming the decoders the system programs the data indicated bythe write dirty. If both the write error and the write dirtyrepresentations are clear then the state is represented by the writecache. This assists in keeping track of the programming without excessoverhead.

A write only representation indicates that the register may not be readfrom. If this flag is set then a read error may not occur.

Over time the system constructs a set of representations of the modelrailroad devices and the model railroad itself indicating the invalidregisters, read errors, and write errors which may increases theefficiently of programming and changing the states of the modelrailroad. This permits the system to avoid accessing particularregisters where the result will likely be an error.

The present inventor came to the realization that the valid registers ofparticular devices is the same for the same device of the same ordifferent model railroads. Further, the present inventor came to therealization that a template may be developed for each particular devicethat may be applied to the representations of the data to predeterminethe valid registers. In addition, the template may also be used to setthe read error and write error, if desired. The template may include anyone or more of the following representations, such as invalid, in use,read error, write only, read dirty, read only, write error, and writedirty for the possible registers of the device. The predetermination ofthe state of each register of a particular device avoids the timeconsuming activity of receiving a significant number of errors and thusconstructing the caches. It is to be noted that the actual read andwrite cache may be any suitable type of data structure.

Many model railroad systems include computer interfaces to attempt tomimic or otherwise emulate the operation of actual full-scale railroads.FIG. 4 illustrates the organization of train dispatching by “timetableand train order” (T&TO) techniques. Many of the rules governing T&TOoperation are related to the superiority of trains which principally iswhich train will take siding at the meeting point. Any misinterpretationof these rules can be the source of either hazard or delay. For example,misinterpreting the rules may result in one train colliding with anothertrain.

For trains following each other, T&TO operation must rely upon timespacing and flag protection to keep each train a sufficient distanceapart. For example, a train may not leave a station less than fiveminutes after the preceding train has departed. Unfortunately, there isno assurance that such spacing will be retained as the trains move alongthe line, so the flagman (rear brakeman) of a train slowing down orstopping will light and throw off a five-minute red flare which may notbe passed by the next train while lit. If a train has to stop, a flagmantrots back along the line with a red flag or lantern a sufficientdistance to protect the train, and remains there until the train isready to move at which time he is called back to the train. A flare andtwo track torpedoes provide protection as the flagman scrambles back andthe train resumes speed. While this type of system works, it dependsupon a series of human activities.

It is perfectly possible to operate a railroad safely without signals.The purpose of signal systems is not so much to increase safety as it isto step up the efficiency and capacity of the line in handling traffic.Nevertheless, it's convenient to discuss signal system principals interms of three types of collisions that signals are designed to prevent,namely, rear-end, side-on, and head-on.

Block signal systems prevent a train from ramming the train ahead of itby dividing the main line into segments, otherwise known as blocks, andallowing only one train in a block at a time, with block signalsindicating whether or not the block ahead is occupied. In many blocks,the signals are set by a human operator. Before clearing the signal, hemust verify that any train which has previously entered the block is nowclear of it, a written record is kept of the status of each block, and aprescribed procedure is used in communicating with the next operator.The degree to which a block frees up operation depends on whetherdistant signals (as shown in FIG. 5) are provided and on the spacing ofopen stations, those in which an operator is on duty. If as is usuallythe case it is many miles to the next block station and thus trains mustbe equally spaced. Nevertheless, manual block does afford a high degreeof safety.

The block signaling which does the most for increasing line capacity isautomatic block signals (ABS), in which the signals are controlled bythe trains themselves. The presence or absence of a train is determinedby a track circuit. Invented by Dr. William Robinson in 1872, the trackcircuit's key feature is that it is fail-safe. As can be seen in FIG. 6,if the battery or any wire connection fails, or a rail is broken, therelay can't pick up, and a clear signal will not be displayed.

The track circuit is also an example of what is designated in railwaysignaling practice as a vital circuit, one which can give an unsafeindication if some of its components malfunction in certain ways. Thetrack circuit is fail-safe, but it could still give a false clearindication should its relay stick in the closed or picked-up position.Vital circuit relays, therefore, are built to very stringent standards:they are large devices; rely on gravity (no springs) to drop theirarmature; and use special non-loading contacts which will not sticktogether if hit by a large surge of current (such as nearby lightning).

Getting a track circuit to be absolutely reliable is not a simplematter. The electrical leakage between the rails is considerable, andvaries greatly with the seasons of the year and the weather. The jointsand bolted-rail track are by-passed with bond wire to assure lowresistance at all times, but the total resistance still varies. It islower, for example, when cold weather shrinks the rails and they pulltightly on the track bolts or when hot weather expands to force the endstightly together. Battery voltage is typically limited to one or twovolts, requiring a fairly sensitive relay. Despite this, the directcurrent track circuit can be adjusted to do an excellent job andfalse-clears are extremely rare. The principal improvement in the basiccircuit has been to use slowly-pulsed DC so that the relay drops out andmust be picked up again continually when a block is unoccupied. Thisallows the use of a more sensitive relay which will detect a train, butadditionally work in track circuits twice as long before leakage betweenthe rails begins to threaten reliable relay operation. Referring toFIGS. 7A and 7B, the situations determining the minimum block length forthe standard two-block, three-indication ABS system. Since the train maystop with its rear car just inside the rear boundary of a block, afollowing train will first receive warning just one block-length away.No allowance may be made for how far the signal indication may be seenby the engineer. Swivel block must be as long as the longest stoppingdistance for any train on the route, traveling at its maximum authorizedspeed.

From this standpoint, it is important to allow trains to move alongwithout receiving any approach indications which will force them to slowdown. This requires a train spacing of two block lengths, twice thestopping distance, since the signal can't clear until the train ahead iscompletely out of the second block. When fully loaded trains running athigh speeds, with their stopping distances, block lengths must be long,and it is not possible to get enough trains over the line to produceappropriate revenue.

The three-block, four-indication signaling shown in FIG. 7 reduces theexcess train spacing by 50%. with warning two blocks to the rear andsignal spacing need be only ½ the braking distance. In particularlycongested areas such as downgrades where stopping distances are long andtrains are likely to bunch up, four-block, four-indication signaling maybe provided and advanced approach, approach medium, approach and stopindications give a minimum of three-block warning, allowing furtherblock-shortening and keeps things moving.

FIG. 8 uses aspects of upper quadrant semaphores to illustrate blocksignaling. These signals use the blade rising 90 degrees to give theclear indication.

Some of the systems that are currently developed by different railroadsare shown in FIG. 8. With the general rules discussed below, a railroadis free to establish the simplest and most easily maintained system ofaspects and indications that will keep traffic moving safely and meetany special requirements due to geography, traffic pattern, orequipment. Aspects such as flashing yellow for approach medium, forexample, may be used to provide an extra indication without an extrasignal head. This is safe because a stuck flasher will result in eithera steady yellow approach or a more restrictive light-out aspect. Inaddition, there are provisions for interlocking so the trains may branchfrom one track to another.

To take care of junctions where trains are diverted from one route toanother, the signals must control train speed. The train travelingstraight through must be able to travel at full speed. Diverging routeswill require some limit, depending on the turnout members and the trackcurvature, and the signals must control train speed to match. Oneapproach is to have signals indicate which route has been set up andcleared for the train. In the American approach of speed signaling, inwhich the signal indicates not where the train is going but rather whatspeed is allowed through the interlocking. If this is less than normalspeed, distant signals must also give warning so the train can bebrought down to the speed in time. FIGS. 9A and 9B show typical signalaspects and indications as they would appear to an engineer. Once aroute is established and the signal cleared, route locking is used toinsure that nothing can be changed to reduce the route's speedcapability from the time the train approaching it is admitted to enteruntil it has cleared the last switch. Additional refinements to thebasic system to speed up handling trains in rapid sequence includesectional route locking which unlocks portions of the route as soon asthe train has cleared so that other routes can be set up promptly.Interlocking signals also function as block signals to provide rear-endprotection. In addition, at isolated crossings at grade, an automaticinterlocking can respond to the approach of a train by clearing theroute if there are no opposing movements cleared or in progress.Automatic interlocking returns everything to stop after the train haspassed. As can be observed, the movement of multiple trains among thetrack potentially involves a series of interconnected activities anddecisions which must be performed by a controller, such as a dispatcher.In essence, for a railroad the dispatcher controls the operation of thetrains and permissions may be set by computer control, therebycontrolling the railroad. Unfortunately, if the dispatcher fails to obeythe rules as put in place, traffic collisions may occur.

In the context of a model railroad the controller is operating a modelrailroad layout including an extensive amount of track, severallocomotives (trains), and additional functionality such as switches. Themovement of different objects, such as locomotives and entire trains,may be monitored by a set of sensors. The operator issues controlcommands from his computer console, such as in the form of permissionsand class warrants for the time and track used. In the existingmonolithic computer systems for model railroads a single operator from asingle terminal may control the system effectively. Unfortunately, thepresent inventor has observed that in a multi-user environment whereseveral clients are attempting to simultaneously control the same modelrailroad layout using their terminals, collisions periodicallynevertheless occur. In addition, significant delay is observed betweenthe issuance of a command and its eventual execution. The presentinventor has determined that unlike full scale railroads where the trackis controlled by a single dispatcher, the use of multiple dispatcherseach having a different dispatcher console may result in conflictinginformation being sent to the railroad layout. In essence, the system isdesigned as a computer control system to implement commands but in nomanner can the dispatcher consoles control the actions of users. Forexample, a user input may command that an event occur resulting in acrash. In addition, a user may override the block permissions or classwarrants for the time and track used thereby causing a collision. Inaddition, two users may inadvertently send conflicting commands to thesame or different trains thereby causing a collision. In such a system,each user is not aware of the intent and actions of other users asidefrom any feedback that may be displayed on their terminal.Unfortunately, the feedback to their dispatcher console may be delayedas the execution of commands issued by one or more users may takeseveral seconds to several minutes to be executed.

One potential solution to the dilemma of managing several users attemptto simultaneously control a single model railroad layout is to develop asoftware program that is operating on the server which observes what isoccurring. In the event that the software program determines that acollision is imminent, a stop command is issued to the train overridingall other commands to avoid such a collision. However, once thecollision is avoided the user may, if desired, override such a commandthereby restarting the train and causing a collision. Accordingly, asoftware program that merely oversees the operation of track apart fromthe validation of commands to avoid imminent collisions is not asuitable solution for operating a model railroad in a multi-userdistributed environment. The present inventor determined that priorvalidation is important because of the delay in executing commands onthe model railroad and the potential for conflicting commands. Inaddition, a hardware throttle directly connected to the model railroadlayout may override all such computer based commands thereby resultingin the collision. Also, this implementation provides a suitable securitymodel to use for validation of user actions.

Referring to FIG. 10, the client program 14 preferably includes acontrol panel 300 which provides a graphical interface (such as apersonal computer with software thereon or a dedicated hardware source)for computerized control of the model railroad 302. The graphicalinterface may take the form of those illustrated in FIGS. 5-9, or anyother suitable command interface to provide control commands to themodel railroad 302. Commands are issued by the client program 14 to thecontrolling interface using the control panel 300. The commands arereceived from the different client programs 14 by the controllinginterface 16. The commands control the operation of the model railroad302, such as switches, direction, and locomotive throttle. Of particularimportance is the throttle which is a state which persists for anindefinite period of time, potentially resulting in collisions if notaccurately monitored. The controlling interface 16 accepts all of thecommands and provides an acknowledgment to free up the communicationstransport for subsequent commands. The acknowledgment may take the formof a response indicating that the command was executed thereby updatingthe control panel 300. The response may be subject to updating if moredata becomes available indicating the previous response is incorrect. Infact, the command may have yet to be executed or verified by thecontrolling interface 16. After a command is received by the controllinginterface 16, the controlling interface 16 passes the command (in amodified manner, if desired) to a dispatcher controller 310. Thedispatcher controller 310 includes a rule-based processor together withthe layout of the railroad 302 and the status of objects thereon. Theobjects may include properties such as speed, location, direction,length of the train, etc. The dispatcher controller 310 processes eachreceived command to determine if the execution of such a command wouldviolate any of the rules together with the layout and status of objectsthereon. If the command received is within the rules, then the commandmay be passed to the model railroad 302 for execution. If the receivedcommand violates the rules, then the command may be rejected and anappropriate response is provided to update the clients display. Ifdesired, the invalid command may be modified in a suitable manner andstill be provided to the model railroad 302. In addition, if thedispatcher controller 310 determines that an event should occur, such asstopping a model locomotive, it may issue the command and update thecontrol panels 300 accordingly. If necessary, an update command isprovided to the client program 14 to show the update that occurred.

The “asynchronous” receipt of commands together with a “synchronous”manner of validation and execution of commands from the multiple controlpanels 300 permits a simplified dispatcher controller 310 to be usedtogether with a minimization of computer resources, such as com ports.In essence, commands are managed independently from the client program14. Likewise, a centralized dispatcher controller 310 working in an“off-line” mode increases the likelihood that a series of commands thatare executed will not be conflicting resulting in an error. This permitsmultiple model railroad enthusiasts to control the same model railroadin a safe and efficient manner. Such concerns regarding theinterrelationships between multiple dispatchers does not occur in adedicated non-distributed environment. When the command is received orvalidated all of the control panels 300 of the client programs 14 maylikewise be updated to reflect the change. Alternatively, thecontrolling interface 16 may accept the command, validate it quickly bythe dispatcher controller, and provide an acknowledgment to the clientprogram 14. In this manner, the client program 14 will not requireupdating if the command is not valid. In a likewise manner, when acommand is valid the control panel 300 of all client programs 14 shouldbe updated to show the status of the model railroad 302.

A manual throttle 320 may likewise provide control over devices, such asthe locomotive, on the model railroad 302. The commands issued by themanual throttle 320 may be passed first to the dispatcher controller 310for validation in a similar manner to that of the client programs 14.Alternatively, commands from the manual throttle 320 may be directlypassed to the model railroad 302 without first being validated by thedispatcher controller 302. After execution of commands by the externaldevices 18, a response will be provided to the controlling interface 16which in response may check the suitability of the command, if desired.If the command violates the layout rules then a suitable correctionalcommand is issued to the model railroad 302. If the command is validthen no correctional command is necessary. In either case, the status ofthe model railroad 302 is passed to the client programs 14 (controlpanels 300).

As it can be observed, the event driven dispatcher controller 310maintains the current status of the model railroad 302 so that accuratevalidation may be performed to minimize conflicting and potentiallydamaging commands. Depending on the particular implementation, thecontrol panel 300 is updated in a suitable manner, but in most cases,the communication transport 12 is freed up prior to execution of thecommand by the model railroad 302.

The computer dispatcher may also be distributed across the network, ifdesired. In addition, the computer architecture described hereinsupports different computer interfaces at the client program 14.

The terms and expressions which have been employed in the foregoingspecification are used therein as terms of description and not oflimitation, and there is no intention, in the use of such terms andexpressions, of excluding equivalents of the features shown anddescribed or portions thereof, it being recognized that the scope of theinvention is defined and limited only by the claims which follow.

1. (canceled)
 2. A system for operating a digitally controlled modelrailroad comprising: (a) a first general purpose computing devicetransmitting a first command from a first program to a second program ofa second general purpose computing device; (b) a third general purposecomputing device transmitting a second command from a third program tosaid second program of said second general purpose computing device,where said first, second, and third general purposes computing devicesare spaced apart from one another; and (c) said second program of saidsecond general purpose computing device sending third and fourthcommands from said second program representative of said first andsecond commands, respectively, to a digital command station that is in aspaced apart location from said first, second, and third general purposecomputing devices.
 3. The system of claim 1, further comprising: (a)said second program providing an acknowledgment to said first program inresponse to receiving said first command by said second program prior tosending said third command to said digital command station; and (b) saidsecond program providing an acknowledgment to said third program inresponse to receiving said second command by said second program priorto sending said fourth command to said digital command station.
 4. Thesystem of claim 2, further comprising: (a) said second programselectively sending said third command to one of a plurality of digitalcommand stations; and (b) said second program selectively sending saidfourth command to one of said plurality of digital command stations. 5.The system of claim 3, further comprising said second program receivingcommand station responses representative of the state of said digitallycontrolled model railroad from said plurality of digital commandstations.
 6. The system of claim 4, further comprising said secondprogram comparing said command station responses to previous commandssent to at least one of said plurality of digital command stations todetermine which of said previous commands it corresponds with.
 7. Thesystem of claim 5, further comprising the steps of: (a) said secondprogram maintaining a sending queue of commands to be transmitted tosaid plurality of digital command stations; and (b) said second programretransmitting at least one of said commands in said sending queueperiodically until removed from said sending queue as a result of thecomparison of said command station responses to previous commands. 8.The system of claim 6, further comprising said second program updating adatabase of the state of said digitally controlled model railroad basedupon said receiving command station responses representative of saidstate of said digitally controlled model railroad.
 9. The system ofclaim 7, further comprising said second program providing saidacknowledgment to said first program in response to receiving said firstcommand by said second program together with state information from saiddatabase related to said first command
 10. The system of claim 8 whereinsaid first command and said third command are the same command, and saidsecond command and said fourth command are the same command.